package com.mdr.imedera.controller.test;

import com.alibaba.fastjson.JSONObject;
import com.mdr.imedera.service.MaterialService;
import com.mdr.imedera.util.RequestResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @PACKAGE_NAME: com.mdr.imedera.controller.test
 * @NAME: wxb
 * @USER: Administrator
 * @DATE: 2020/10/22
 * @TIME: 14:44
 * @YEAR: 2020
 * @MONTH: 10
 * @MONTH_NAME_SHORT: 10月
 * @MONTH_NAME_FULL: 十月
 * @DAY: 22
 * @DAY_NAME_SHORT: 周四
 * @DAY_NAME_FULL: 星期四
 * @HOUR: 14
 * @MINUTE: 44
 * @PROJECT_NAME: imedera
 * @Dsecription 素材接口
 **/
@RestController
@RequestMapping("material")
public class MaterialController {

    @Autowired private MaterialService materialService;

    @GetMapping("list")
    public RequestResult getMaterialList(@RequestParam(defaultValue = "1") Integer pageIndx,
                                         @RequestParam(defaultValue = "15") Integer pageSize,
                                         @RequestParam(defaultValue = "news") String type){

        JSONObject materialList = materialService.getMaterialList(type, pageIndx, pageSize);
        return RequestResult.success("请求成功",materialList);
    }

}
